home *** CD-ROM | disk | FTP | other *** search
/ Core Concepts in Art 2 / Core Concepts in Art (Frames of Reference)(The McGraw-Hill Companies)(2004).iso / mac / media / search.swf / scripts / frame_1 / DoAction.as < prev   
Text File  |  2003-10-12  |  4KB  |  182 lines

  1. function createQuestionArray(whichChapter)
  2. {
  3.    j = 1;
  4.    while(j <= this["chaptArray" + whichChapter].questionNum)
  5.    {
  6.       if(this["ch" + whichChapter] == undefined)
  7.       {
  8.          this["ch" + whichChapter] = new Array();
  9.       }
  10.       this["ch" + whichChapter].push(j);
  11.       j++;
  12.    }
  13.    chapterArray.push(this["ch" + whichChapter]);
  14.    if(chapterArray.length == _root.howManyChapters + 1)
  15.    {
  16.       createButtons();
  17.    }
  18. }
  19. function createButtons()
  20. {
  21.    i = 0;
  22.    while(i < _root.howManyChapters)
  23.    {
  24.       duplicateMovieClip("chapter_mc","chaptBtn" + i,16384 + (100 + i));
  25.       if(_root.agreed == undefined)
  26.       {
  27.          this["chaptBtn" + i]._visible = 0;
  28.       }
  29.       else
  30.       {
  31.          this["chaptBtn" + i]._visible = 1;
  32.       }
  33.       this["chaptBtn" + i].highlight_mc._visible = 0;
  34.       if(i < 9)
  35.       {
  36.          this["chaptBtn" + i]._x = chapter_mc._x + 12 * i;
  37.       }
  38.       else
  39.       {
  40.          this["chaptBtn" + i]._x = chapter_mc._x - 64 + 20 * i;
  41.       }
  42.       if(i > 15)
  43.       {
  44.          this["chaptBtn" + i]._y = chapter_mc._y + 16;
  45.          this["chaptBtn" + i]._x -= 248;
  46.       }
  47.       if(i > 27)
  48.       {
  49.          this["chaptBtn" + i]._y = chapter_mc._y + 32;
  50.          this["chaptBtn" + i]._x -= 240;
  51.       }
  52.       var chapterColor = new Color(this["chaptBtn" + i].theChap);
  53.       chapterColor.setRGB(_root.restColor);
  54.       this["chaptBtn" + i].theNum = i + 1;
  55.       if(i < _root.dropChapters)
  56.       {
  57.          this["chaptBtn" + i].chap_btn._visible = 0;
  58.          this["chaptBtn" + i]._alpha = 30;
  59.       }
  60.       i++;
  61.    }
  62.    findStartChapter();
  63.    variableHolder_mc.firstTime = 1;
  64. }
  65. function processCaption(whichTitle)
  66. {
  67.    var variables = new Array("title","artist","medium","date","location","dimensions");
  68.    captions.captionInfo = "";
  69.    i = 0;
  70.    while(i < variables.length)
  71.    {
  72.       if(this["vh" + whichTitle][variables[i]].length != 0)
  73.       {
  74.          captions.captionInfo = captions.captionInfo + this["vh" + whichTitle][variables[i]] + "\n";
  75.       }
  76.       i++;
  77.    }
  78. }
  79. function processArray()
  80. {
  81.    i = 0;
  82.    while(i < _root.questionsWithImages.length)
  83.    {
  84.       _root.questionsWithImages[i].sort(sortNumerically);
  85.       j = 0;
  86.       while(j < _root.questionsWithImages[i].length)
  87.       {
  88.          if(_root.questionsWithImages[i][j] == _root.questionsWithImages[i][j + 1])
  89.          {
  90.             _root.questionsWithImages[i].splice(j + 1,1);
  91.          }
  92.          j++;
  93.       }
  94.       i++;
  95.    }
  96. }
  97. function sortNumerically(element1, element2)
  98. {
  99.    return element1 - element2;
  100. }
  101. function findStartChapter()
  102. {
  103.    i = 0;
  104.    while(i <= _root.howManyChapters)
  105.    {
  106.       if(chapterArray[i].length != 0)
  107.       {
  108.          theChapter = i;
  109.          doHighlight(i);
  110.          return undefined;
  111.       }
  112.       i++;
  113.    }
  114. }
  115. function doHighlight(whichToHighlight)
  116. {
  117.    i = 0;
  118.    while(i <= _root.howManyChapters)
  119.    {
  120.       if(i == whichToHighlight)
  121.       {
  122.          this["chaptBtn" + (i - 1)].highlight_mc._visible = 1;
  123.          if(i > 9)
  124.          {
  125.             this["chaptBtn" + (i - 1)].highlight_mc._width = 20;
  126.             this["chaptBtn" + (i - 1)].highlight_mc._x = 4;
  127.          }
  128.       }
  129.       else
  130.       {
  131.          this["chaptBtn" + (i - 1)].highlight_mc._visible = 0;
  132.       }
  133.       i++;
  134.    }
  135. }
  136. function nextCard()
  137. {
  138.    caption_txt.text = "";
  139.    variableHolder_mc.firstTime = 1;
  140. }
  141. function removeOldHolders()
  142. {
  143.    i = 0;
  144.    while(i < chapterArray[theChapter].length)
  145.    {
  146.       removeMovieClip("vh" + i);
  147.       removeMovieClip(titlesHolder["titles" + i]);
  148.       i++;
  149.    }
  150. }
  151. function createHolders()
  152. {
  153.    k = 0;
  154.    while(k < chapterArray[theChapter].length)
  155.    {
  156.       duplicateMovieClip("variableHolder_mc","vh" + k,16384 + (200 + k));
  157.       k++;
  158.    }
  159. }
  160. function findFilePath(theChap, theQuest, theTarget)
  161. {
  162.    if(theChap < 10)
  163.    {
  164.       if(theQuest < 10)
  165.       {
  166.          loadVariables("txtFiles/Ch0" + theChap + "-0" + theQuest + ".txt",theTarget);
  167.       }
  168.       else
  169.       {
  170.          loadVariables("txtFiles/Ch0" + theChap + "-" + theQuest + ".txt",theTarget);
  171.       }
  172.    }
  173.    else if(theQuest < 10)
  174.    {
  175.       loadVariables("txtFiles/Ch" + theChap + "-0" + theQuest + ".txt",theTarget);
  176.    }
  177.    else
  178.    {
  179.       loadVariables("txtFiles/Ch" + theChap + "-" + theQuest + ".txt",theTarget);
  180.    }
  181. }
  182.